// pages/subImformation/subImformation.js
const app = getApp()
const pathUrl = app.globalData.pathUrl;
var util = require('../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    proAry: ['填写申请', '提交资料', '提交申请'],
    product: "", // 产品名称
    name: "", // 客户姓名
    price: "", // 借款金额
    orderPeriod: "", // 借款期数
    orderPeriod1: "", // 借款用途
    hzqd: "", // 合作渠道
    id:"",

    query01: "",
    query02: "",
    query03: "",
    query04: "",
    query05: "",
    query06: "",
    query07: "",
    query08: "",
    query09: "",
    query10: "",
    query11: "",
    query12: "",
    query13: "",
    query14: "",
    query15: "",
    query16: "",
    query17: "",
    query18: "",
    query19: "",
    query20: "",
    query21: "",
    query22: "",
    query23: "",
    query24: "",
    query25: "",
    query26: "",
    query27: "",
    query28: "",
    query29: "",
    query30: "",
    query31: "",
    query32: "",
    query33: "",
    query34: "",
    query35: "",
    query36: "",
    query37: "",
    query38: "",
    query39: "" 
  },

  /**
   * 生命周期函数--监听页面加载
   */
  //   url: '../subImformation/subImformation?product=' + data01.query05 + '&name=' + data01.query07 + '&query09=' + data01.query09 + '&orderPeriod=' + data01.query16 + '&orderPeriod1=' + data01.query17 + '&hzqd=' + data01.query12
  onLoad: function(options) {
    var that = this;
    that.setData({
      product: options.product, // 产品名称
      name: options.name, // 客户姓名
      price: options.query09, // 借款金额
      orderPeriod: options.orderPeriod, // 借款期数
      orderPeriod1: options.orderPeriod1, // 借款用途
      hzqd: options.hzqd // 合作渠道
    });
    // this.search();
  },
  search: function(){
    var that = this;
    console.log(that.data.product);
    wx.request({
      url: pathUrl + '/xdbuse/fxjBuse01/list',
      method: 'GET',
      data: {
        query05: that.data.product,
        query07: that.data.name,
        query09: that.data.price,
        query12: that.data.hzqd,
        query16: that.data.orderPeriod,
        query17: that.data.orderPeriod1,
      },
      success: function (res) {
        console.log(res);
        if (res.data){
          if (res.data.success){
            that.setData({
              id: res.data.result.records[0].id
            });
          }else{
            wx.showToast({
              title: '数据加载失败',
              icon: 'fail'
            })
          }
        }else{
          wx.showToast({
            title: '数据加载失败',
            icon: 'fail'
          })
        }
      },
      fail: function (res) { }
    });
  },

  // 个人信息
  goPersonalInformation:function(e){
    wx.navigateTo({
      url: '../personalInformation/personalInformation?id=' + e.currentTarget.dataset.id,
    });
  },
  // 工作信息
  goWorkInformation:function(e){
    wx.navigateTo({
      url: '../workInformation/workInformation?id=' + e.currentTarget.dataset.id,
    });
  },
  // 联系人信息
  goContactInformation:function(e){
    wx.navigateTo({
      url: '../contactInformation/contactInformation?id=' + e.currentTarget.dataset.id,
    });
  },
  // 绑定银行卡
  goBindBank:function(e){
    wx.navigateTo({
      url: '../bingBank/bingBank?id=' + e.currentTarget.dataset.id,
    });
  },
  // 下一步
  next:function(){
    wx.switchTab({
      url: '/pages/order/order',
    })
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})